import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_web_study/page/home_page.dart';
import 'package:flutter_web_study/page/login_page.dart';
import 'package:flutter_web_study/page/search_page.dart';
import 'package:logger/logger.dart';

import '../page/new_shop_page.dart';
import '../page/product_review_page.dart';

var loginHandler =
    Handler(handlerFunc: (BuildContext? context, Map<String, dynamic> params) {
  return const LoginPage();
});

var homeHandler =
    Handler(handlerFunc: (BuildContext? context, Map<String, dynamic> params) {
  return const HomePage();
});

var newShopPageHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
  String? jsonBean = params["jsonBean"]?.last;
  return NewShopPage(jsonBean: jsonBean);
});

var productReviewPageHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
  String jsonBean = params["jsonBean"]?.last??"";
  int tagPage = int.parse("${params["tagPage"]?.last}");
  Logger().d(jsonBean);
  return ProductReviewPage(tagPage: tagPage, jsonBean: jsonBean);
});
var searchPageHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
  // "brand": "${textEditingController1.text.toString().trim()}",
  // "series": "${textEditingController3.text.toString().trim()}"
  String? tagPage = params["tagPage"]?.last;
  String? brand = params["brand"]?.last;
  String? series = params["series"]?.last;
  return SearchPage(tagPage: tagPage, brand: brand, series: series);
});
